package com.jiyun.baodian.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiyun.baodian.mapper.BaodianMapper;
import com.jiyun.baodian.service.BaodianService;
import com.jiyun.pojo.baodian.BaoDian;
import com.jiyun.pojo.baodian.BaoDianVo;
import com.jiyun.pojo.luyin.Luyin;
import com.jiyun.pojo.result.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文件名:BaodianServiceImp
 * 创建者: 闫俊涛
 * 创建时间:2022/6/27 18:54
 * 描述:这是一个实例
 */
@Service
public class BaodianServiceImp extends ServiceImpl<BaodianMapper, BaoDian>  implements BaodianService {

    @Autowired
    private  BaodianMapper baodianMapper;
    @Override
    public ResultVo listAll(BaoDianVo dto) {
        QueryWrapper<BaoDian> queryWrapper = new QueryWrapper<>();
        if (dto.getName()!=null && dto.getName()!=""){
            queryWrapper.like("headline",dto.getName());
        }
        List<BaoDian> baoDians = baodianMapper.selectList(queryWrapper);
        return new ResultVo(200,"查询成功",baoDians);
    }

}
